package com.bangdream.michelia.view.adapter;



import com.bangdream.michelia.R;
import com.bangdream.michelia.entity.DomainBean;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

/**
 * Created by zhouyi on 2018/3/25.
 */

public class PopListAdapter extends BaseQuickAdapter<DomainBean,BaseViewHolder> {

    private String defItem = "";

    public PopListAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, DomainBean item) {

        helper.setText(R.id.name,item.getName()+"");

        if (defItem.equals(item.getCode())) {
            helper.setBackgroundColor(R.id.name, mContext.getResources().getColor(R.color.pop_bg));
        } else {
            helper.setBackgroundColor(R.id.name, mContext.getResources().getColor(R.color.pop_bg_un));
        }
    }


    public void setDefSelect(String mainCode) {
        this.defItem = mainCode;
        notifyDataSetChanged();

    }

}
